<?php
class addAction extends rareAction{
    public function execute(){
		if(!Tool::_getCache('isAdmin')){
			Tool::_setCache('currentID',service_menu::getCurrent('1',service_type::LINKS));
		}
	}
    public function executePost(){
        $links = $this->getPostParam('links',array());
        if(empty($links)) jsonReturn(0,'add fail');
        
        $linksDao = new DaoLinks();
        $links['title'] = trim($links['title']);
        $links['url'] = trim($links['url']);
        
        $flag = $linksDao->insert($links);
        echo $flag;
        if($flag>0){
            jsonReturn(1,'ok');
        }else{
            jsonReturn(0,'fail');
        }
    }
}
?>
